<?php defined('SYSPATH') or die('No direct script access.');
 
class mydate 
{
    public static function select_time($name, $time=null)
    {
    	if($time)
		{
			list($h, $s, $i) = explode(':', $time);
		}
		else
		{
			$h = '00'; $s = '00'; $i = '00';
		}
		
    	$str = '';
		$str .= '<select name="'.$name.'_h">';
		
		for($i=0; $i<=23; $i++)
		{
			$_h = $i<10 ? '0'.$i : $i;
			$str .= '<option '.($h == $_h ? 'selected="selected"' : '').'>'.$_h.'</option>';
		}
		
		$str .= '</select> : <select name="'.$name.'_s">';

		for($i=0; $i<=55; $i+=5)
		{
			$_s = $i<10 ? '0'.$i : $i;
			$str .= '<option '.($s == $_s ? 'selected="selected"' : '').'>'.$_s.'</option>';
		}

		$str .= '</select>';
			
		return $str;
    }
}